package edu.towson.cosc603.coffeemaker;

import junit.framework.Assert;
import junit.framework.TestCase;

public class RecipeTest extends TestCase 
{

	CoffeeMaker myCoffeeMaker = null;
	Recipe myRecipe = null;
	
	//public RecipeTest(String name) 
	//{
	//	super(name);
		
	//}
	

	public void setUp() throws Exception 
	{
		super.setUp();
		//4 new recipes and inventory created when creating coffee machine
		myCoffeeMaker = new CoffeeMaker();
		myRecipe = new Recipe();
	}

	public void tearDown() throws Exception 
	{
		super.tearDown();
	}

	

	public void testSetAmtChocolateHighLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtChocolate(2147483632);
		Assert.assertEquals(2147483632, myRecipe.getAmtChocolate());
	} 
	
	public void testSetAmtChocolateZeroLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtChocolate(0);
		Assert.assertEquals(0, myRecipe.getAmtChocolate());
	} 
	
	public void testSetAmtChocolateNegLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtChocolate(-15);
		Assert.assertEquals(0, myRecipe.getAmtChocolate());
	} 

	

	public void testSetAmtCoffeeHighLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtCoffee(2147483632);
		Assert.assertEquals(2147483632, myRecipe.getAmtCoffee());
	}

	public void testSetAmtCoffeeLowLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtCoffee(0);
		Assert.assertEquals(0, myRecipe.getAmtCoffee());
	}
	
	public void testSetAmtCoffeeNegLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtCoffee(-15);
		Assert.assertEquals(0, myRecipe.getAmtCoffee());
	}
	
	

	public void testSetAmtMilkHighLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtMilk(2147483632);
		Assert.assertEquals(2147483632, myRecipe.getAmtMilk());
	}
	
	public void testSetAmtMilkLowLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtMilk(0);
		Assert.assertEquals(0, myRecipe.getAmtMilk());
	}
	
	public void testSetAmtMilkNegLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtMilk(-15);
		Assert.assertEquals(0, myRecipe.getAmtMilk());
	}

	

	public void testSetAmtSugarHighLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtSugar(2147483632);
		Assert.assertEquals(2147483632, myRecipe.getAmtSugar());
	}
	
	public void testSetAmtSugarLowLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtSugar(0);
		Assert.assertEquals(0, myRecipe.getAmtSugar());
	}
	
	public void testSetAmtSugarNegLimit()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtSugar(-15);
		Assert.assertEquals(0, myRecipe.getAmtSugar());
	}

	

	public void testSetName()
	{
		myRecipe = new Recipe();
		myRecipe.setName("TestRecipe");
	}

	
	public void testSetPrice() 
	{
		myRecipe = new Recipe();
		myRecipe.setPrice(1);
		Assert.assertEquals(1, myRecipe.getPrice());
	}

	public void testSetPriceNegValue() 
	{
		myRecipe = new Recipe();
		myRecipe.setPrice(-1);
		Assert.assertEquals(0, myRecipe.getPrice());
	}

	
	public void testEqualsRecipe()
	{
		myRecipe = new Recipe();
		myRecipe.setAmtChocolate(10);
		myRecipe.setAmtCoffee(10);
		myRecipe.setAmtMilk(10);
		myRecipe.setAmtSugar(10);
		myRecipe.setName(null);
		myRecipe.setPrice(1);
		
		Recipe testRecipe = new Recipe();
		testRecipe = new Recipe();
		testRecipe.setAmtChocolate(10);
		testRecipe.setAmtCoffee(10);
		testRecipe.setAmtMilk(10);
		testRecipe.setAmtSugar(10);
		testRecipe.setName("TestCup");
		testRecipe.setPrice(1);
		
		Assert.assertEquals(false, myRecipe.equals(testRecipe));
		
	}

	public void testToString()
	{
		testSetName();
		Assert.assertEquals("TestRecipe", myRecipe.toString());
	}

}
